<template>
	<view class="baseForm">
		<u-loading-page :loading="loading"></u-loading-page>
		<view v-if="!loading" class="overhidden">
			<view>
				<!-- 选择设备 -->
				<view v-if="props.isRead == 0" class="searchScan">
					<u-input placeholder="请选择设备或扫描设备码" disabled>
						<template #suffix>
							<u-icon name="scan" size="27px" :bold="false" @click="openScan"></u-icon>
						</template>
					</u-input>
					<u-button class="addBtn1" size="small" type="primary" text="选择" @click="jump('/eam/equ/selectDevice/index')"></u-button>
				</view>
				<!-- 设备详情 -->
				<DeviceInfoTemplate :taskInfo="taskInfo"></DeviceInfoTemplate>
				<!-- <view v-if="props.isRead == 0 && taskInfo.assetCode" class="searchScan">
					<u-button size="small" type="primary" text="选择点检标准"
						@click="jumpStandard('/eam/equ/pointInspection/components/inspectionChecklist', taskInfo.assetTypeId, taskInfo.locationId)"></u-button>
				</view> -->
				<!-- <view style="text-align: center;">
					{{sopStandardNames}}
				</view> -->
				<!-- 设备详情 -->
				<PointListInfo v-if="sopStandardIds" :sopStandardId="sopStandardIds" :sopStandardName="sopStandardNames"></PointListInfo>
				<view class="plan card record-content" style="margin-bottom: 70px">
					<view v-show="!taskInfo?.details || taskInfo?.details.length === 0" class="flex justify-start grey-color" style="margin: 12px 0 10px">暂无点检信息</view>
					<view class="overhidden" v-for="(item, index) in taskInfo?.details" :key="index">
						<view>
							<view class="record-content">
								<view class="record-item">
									<view class="title_new">
										<text class="require_icon" v-if="item?.sopItem.sopExecute == '1'">*</text>
										{{ item?.sopItemName || '' }}
										<u-icon
											v-if="item?.sopItem.sopItemMethod || item?.sopItem.sopItemStandardValue || item?.sopItem.sopItemTool || item?.sopItem.sopItemPosition"
											name="info-circle-fill"
											color="rgb(192, 196, 204)"
											size="18"
											@click="openInfoModal(item.sopItem)"
										></u-icon>
									</view>
									<view class="" v-if="item.sopItem.standardValue == 1" style="max-width: 100px; min-width: 70px">
										<u--input
											v-if="props.isRead == 0"
											v-model="item.sopItemValue"
											placeholder="请输入"
											class="minInput"
											:class="sizeColorHandle(item.sopItemValue, item?.sopItem.standardMinValue, item?.sopItem.standardMaxValue)"
											inputAlign="right"
											clearable
											border="none"
										></u--input>
										<text
											v-else
											:class="sizeColorHandle(item.sopItemValue, item?.sopItem.standardMinValue, item?.sopItem.standardMaxValue)"
											style="text-align: right"
											class="text-span-flex-end"
										>
											{{ item.sopItemValue || '' }}
										</text>
									</view>
									<view class="" v-if="item.sopItem.standardValue == 2" style="max-width: 100px; min-width: 70px">
										<view v-if="props.isRead == 0 || props.isRead == 5" class="flex input-box" style="justify-content: flex-end">
											<view
												class="minInput"
												:class="sizeColorHandle1(item.sopItemValueId, item.sopItem.details ?? [])"
												@click.stop="hideKeyboard(index, item.sopItem.details ?? [])"
											>
												<view class="">
													{{ item.sopItemValue ? item.sopItemValue : '' }}
												</view>
												<view class="" style="color: #c0c4cc">
													{{ item.sopItemValue ? '' : '请选择' }}
												</view>
											</view>
											<image @click.stop="clearData(index)" v-if="item.sopItemValueId !== ''" src="@/static/image/delete.png" class="deleteIcon" />
										</view>
										<text
											v-else
											:class="sizeColorHandle1(item.sopItemValueId, item.sopItem.details ?? [])"
											style="text-align: right"
											class="text-span-flex-end"
										>
											{{ item.sopItemValue || '' }}
										</text>
									</view>
								</view>
								<!-- <view class="record-item" v-if="item.sopItem.standardValue == 1 && !(!item.sopItem.standardMinValue && !item.sopItem.standardMaxValue)">
												<text>上下限值</text>
												<text v-if="item?.sopItem.standardMinValue !== item?.sopItem.standardMaxValue">
													{{ item?.sopItem.standardMinValue || '' }}-{{ item?.sopItem.standardMaxValue || '' }}{{ item?.standardValueUnit || '' }}
												</text>
												<text v-else>{{ item?.sopItem.standardMinValue || '' }}{{ item?.sopItem.standardValueUnit || '' }}</text>
											</view> -->
								<view class="record-item" v-if="item.sopItemStandard">
									<text>标准要求</text>
									<text>{{ item.sopItemStandard }}</text>
								</view>
								<!-- <view class="record-item" v-if="item.sopItem.standardValue == 1">
									<view class="flex">
										实际值
										<text class="require_icon" v-if="item?.sopItem.sopExecute == '1'">*</text>
									</view>
									<u--input
										v-if="props.isRead == 0 || props.isRead == 5"
										v-model="item.sopItemValue"
										placeholder="请输入"
										class="minInput"
										:class="sizeColorHandle(item.sopItemValue, item?.sopItem.standardMinValue, item?.sopItem.standardMaxValue)"
										inputAlign="right"
										clearable
										border="none"
										
									></u--input>
									<text v-else :class="sizeColorHandle(item.sopItemValue, item?.sopItem.standardMinValue, item?.sopItem.standardMaxValue)">
										{{ item.sopItemValue || '' }}
									</text>
								</view>
								<view class="record-item" v-if="item.sopItem.standardValue == 2">
									<view class="flex" >
										实际值
										<text class="require_icon" v-if="item?.sopItem.sopExecute == '1'">*</text>
									</view>
									<view v-if="props.isRead == 0 || props.isRead == 5" class="flex input-box">
										<view
											class="minInput"
											style="width:400rpx"
											:class="sizeColorHandle1(item.sopItemValueId, item.sopItem.details ?? [])"
											@click.stop="hideKeyboard(index, item.sopItem.details ?? [])"
											
										>
											<view class=""  >
												{{ item.sopItemValue? item.sopItemValue:'' }}
											</view>
											<view class="" style="color:#c0c4cc">
												{{ item.sopItemValue? '':'请选择' }}
											</view>
										</view>
										<image @click.stop="clearData(index)" v-show="item.sopItemValueId" src="@/static/image/delete.png" class="deleteIcon" />
									</view>
									<text v-else :class="sizeColorHandle1(item.sopItemValueId, item.sopItem.details ?? [])">
										{{ item.sopItemValue || '' }}
									</text>
								</view>
							 -->
							</view>

							<!-- 待需要上传图片后启用 -->
							<view class="mt-8 flex" v-if="item.sopItem.sopImage == '1'">
								<upload-image
									:multiple="false"
									:key="index"
									:keys="index"
									@fileChange="(list) => getImages(list, index)"
									:list="item.images ?? []"
									:capture="capture"
									folderName="eam/equ/pointInspection"
									:isRead="props.isRead == 1 ? true : false"
								></upload-image>
							</view>
						</view>
						<u-divider v-show="index + 1 !== taskInfo?.details.length"></u-divider>
					</view>

					<!-- 查看页面并且没有现场图片则不展示 -->
					<view>
						<view class="title flex justify-between">
							<text class="mt-4">现场图片</text>
						</view>

						<view class="mt-8">
							<view class="mt-8 flex">
								<upload-image
									folderName="eam/equ/pointInspection"
									:multiple="false"
									:keys="4545"
									@fileChange="getSceneImages"
									:list="taskInfo.images ?? []"
									:capture="capture"
								></upload-image>
							</view>
						</view>
					</view>
				</view>
				<!-- new 增加问题描述 problemDesc-->

				<view class="detail card" v-if="props.isRead == 0 || props.isRead == 5" style="margin-top: -60px">
					<view class="flex flex-col justify-between flex-1 h-full">
						<view class="record-content">
							<view class="flex title justify-between" style="margin: 6px 0 !important">
								<text>问题描述</text>
							</view>
						</view>
						<view class="record-item" style="width: 100%">
							<u--textarea
								v-model="taskInfo.problemDesc"
								placeholder="请输入"
								class="minTextarea"
								inputAlign="right"
								clearable
								border="none"
								maxlength="250"
								autoHeight
								height="auto"
							></u--textarea>
						</view>
					</view>
				</view>

				<view class="detail card" v-if="props.isRead == 1 && taskInfo.problemDesc" style="margin-top: -60px">
					<view class="flex flex-col justify-between flex-1 h-full">
						<view class="record-content">
							<view class="flex title justify-between" style="margin: 6px 0 !important">
								<text>问题描述</text>
							</view>
						</view>
						<view class="record-item">
							<view class="font-14">
								{{ taskInfo.problemDesc || '' }}
							</view>
						</view>
					</view>
				</view>
				
				<view class="detail card">
					<view class="record-content flex flex-col justify-between flex-1 h-full">
						<view class="record-item" style="margin:4px 0">
							<text>设备状态</text>
							<text v-if="taskInfo?.checkResult == 1">
								正常
							  </text>
							  <text v-if="taskInfo?.checkResult == 0" style="color: red;">
								异常
							  </text>
						</view>
						<view class="record-item" style="margin:4px 0">
							<text>点检状态</text>
							<text v-if="taskInfo?.orderStatus == 3">
							  异常
							</text>
							<text v-if="taskInfo?.orderStatus == 2">
							  已提交
							</text>
							<text v-if="taskInfo?.orderStatus == 0 || taskInfo?.orderStatus == 1">
								未提交
							</text>
						</view>
					</view>
				</view>
				
				
				
				<view style="height: 90px"></view>
				<!-- 提交 -->
				<view class="submit_btn_div" v-if="props.isRead == 0 || props.isRead == 5">
					<button type="default" class="grey_btn" :disabled="saveLoading" :loading="saveLoading" @click="saveSubmit">保 存</button>
					<button type="primary" :disabled="postLoading" :loading="postLoading" @click="submit" class="submit_btn">提 交</button>
				</view>
			</view>
			<!-- 实际值选择picker -->
			<u-picker
				:show="showPicker"
				:columns="currentColumns"
				:defaultIndex="defaultIndex"
				keyName="text"
				immediateChange
				@cancel="showPicker = false"
				@confirm="changeData"
			></u-picker>
			<u-modal :show="showInfo" :content="contentInfo" @confirm="showInfo = false"></u-modal>
		</view>
	</view>
</template>

<script lang="ts" setup>
import { nextTick, ref, toRefs, watch, reactive, computed, toRaw } from 'vue';
import { onShow, onLoad, onPullDownRefresh, onLaunch, onBackPress } from '@dcloudio/uni-app';
import UploadImage from '@/components/upload-image-ssr.vue';
import DeviceInfoTemplate from '@/pages/eam/equ/pointInspection/components/pointDeviceInfo.vue';
import PointListInfo from '@/pages/eam/equ/pointInspection/components/pointListInfo.vue';

import { http } from '@/utils/http';

import { useEamStore } from '@/stores/useEamStore';

import { sizeColorHandle1, sizeColorHandle } from '@/utils/common';

const props = defineProps({
	id: {
		type: String,
		default: ''
	},
	isRead: {
		type: String,
		default: '0'
	},
	assetKind: {
		type: String,
		default: ''
	},
	sopStandardId: {
		type: String,
		default: ''
	}
});
const { sopStandardId, assetKind } = toRefs(props);
//
onLoad(() => {
	if (props.id) {
		initPage();
	}
});

// 初始化页面，获取检查详情
let taskInfo = reactive({
	locationName: '',
	assetKind: 3,
	assetCode: '',
	assetId: '',

	assetName: '',
	assetTypeId: '',
	locationId: '',
	checkPersonId: '',
	checkPersonName: '',
	checkResult: '',
	createTime: '',
	createdUserId: '',
	createdUserName: '',
	problemDesc: '',
	deleted: '',
	details: [],
	exceptionNumber: '',
	executePersonId: '',
	executePersonName: '',
	id: '',

	inspectionTaskId: '',
	lastUpdateTime: '',
	lastUpdatedUserId: '',
	lastUpdatedUserName: '',
	notInspectedNumber: '',
	orderNo: '',
	orderStatus: 0,
	planId: '',
	planName: '',
	planNo: '',
	planTime: '',
	remarks: '',
	sopStandardCode: '',
	sopStandardId: '',
	sopStandardName: '',
	sopTypeCode: '',
	sopTypeId: '',
	sopTypeName: '',
	version: '',
	workTime: ''
});

// 作业方法提示框
const showInfo = ref(false);
const contentInfo = ref('');
function openInfoModal(data) {
	showInfo.value = true;
	contentInfo.value = '';
	if (data.sopItemMethod) {
		contentInfo.value += `作业方法：${data.sopItemMethod}\n\n`;
	}
	if (data.sopItemStandardValue) {
		contentInfo.value += `作业标准：${data.sopItemStandardValue}\n\n`;
	}
	if (data.sopItemTool) {
		contentInfo.value += `作业工具：${data.sopItemTool}\n\n`;
	}
	if (data.sopItemPosition) {
		contentInfo.value += `作业部位：${data.sopItemPosition}\n\n`;
	}
}

/**
 * 选择实际值
 */
const showPicker = ref(false);
const currentColumns = reactive([[]]);
const currentIndex = ref();
const defaultIndex = ref([0]);

/**
 * 组织键盘弹出
 */
function hideKeyboard(index, list) {
	const lists = JSON.parse(JSON.stringify(list));
	lists.forEach((item) => {
		item.text = `${item.standardValue} - ${item.resultValue == '1' ? '正常' : '异常'}`;
	});
	currentIndex.value = index;
	currentColumns[0] = lists ?? [];
	// 给原有的值,赋值picker默认index
	const sopItemValueId = taskInfo.details[index].sopItemValueId;
	if (sopItemValueId) {
		const currentIndex = list.findIndex((self) => self.id === sopItemValueId);
		defaultIndex.value = [currentIndex];
	} else {
		defaultIndex.value = [0];
	}
	showPicker.value = true;
	uni.hideKeyboard();
}
function clearData(index) {
	taskInfo.details[index].sopItemValueId = '';
	taskInfo.details[index].sopItemValue = '';
	showPicker.value = false;
}
function changeData(e) {
	taskInfo.details[currentIndex.value].sopItemValue = e.value[0].standardValue;
	taskInfo.details[currentIndex.value].sopItemValueId = e.value[0].id;
	showPicker.value = false;
}

// 表单详情
let formData = reactive({
	consumeCode: ''
});

// 初始化页面，获取检查详情
// let taskInfo = ref<any>({});
const loading = ref(false);

// 表单规则定义
const rules = ref({});

// 摄像头参数设置
const capture = ref(['camera', 'album']);
// 获取图片
function getImages(list, index) {
	const current = JSON.parse(JSON.stringify(taskInfo.details))[index];
	current.images = [];
	list?.forEach((item) => {
		current.images.push(item);
	});
	const elder = JSON.parse(JSON.stringify(taskInfo.details));
	elder[index] = current;
	taskInfo.details = elder;
}

// 获取现场图片
function getSceneImages(list) {
	taskInfo.images = list;
}

// form信息重置
function resetData() {
	formData.consumeCode = '';
	uni.pageScrollTo({
		scrollTop: 0,
		duration: 100
	});
}

// 重置表单信息 & 光标自动blur
const scanBarRef = ref();
const datekey = ref(new Date());
function resetFields() {
	resetData();
	scanBarRef.value.reset();
	datekey.value = new Date();
}

// 校验提交
const uForm = ref();

// 保存
const saveLoading = ref(false);
async function saveSubmit() {
	if (props.id !== '') {
		taskInfo.id = props.id;
	}

	// 校验是否录入工装编号成功;
	if (!taskInfo.assetId) {
		uni.showToast({
			title: '点检设备不能为空',
			icon: 'none'
		});
		return false;
	}

	if (taskInfo.details.length == 0) {
		uni.showToast({
			title: '请选择点检标准',
			icon: 'none'
		});
		return;
	}
	// 校验判断数字
	for (let i = 0; i < taskInfo.details.length; i++) {
		if (taskInfo.details[i].sopItem.standardValue == '1') {
			if (isNaN(Number(taskInfo.details[i].sopItemValue))) {
				uni.showToast({
					title: `${taskInfo.details[i].sopItemName}的实际值只能为数字`,
					icon: 'none'
				});
				return false;
			}
		}
	}

	// 校验是否录入工装编号成功

	// save提交
	saveLoading.value = true;
	const result: any = await http({
		method: 'POST',
		url: `/eam/equPointInspectionOrder/save `,
		data: toRaw(taskInfo)
	}).catch(() => {
		saveLoading.value = false;
	});
	if (result?.code == 200) {
		uni.showToast({
			title: '保存成功'
		});

		// uni.navigateTo({
		// 	url: `/pages/eam/equ/pointInspection/index`
		// });
	}
	saveLoading.value = false;
}

// 提交
const postLoading = ref(false);
async function submit() {
	// 校验是否录入工装编号成功
	if (props.id !== '') {
		taskInfo.id = props.id;
	}
	if (!taskInfo.assetId) {
		uni.showToast({
			title: '点检设备不能为空',
			icon: 'none'
		});
		return false;
	}

	if (taskInfo?.details.length == 0) {
		uni.showToast({
			title: '请选择点检标准',
			icon: 'none'
		});
		return false;
	}
	// 校验必填项是否填写
	const infos = taskInfo?.details ?? [];
	if (infos.length) {
		for (let i = 0; i < infos.length; i++) {
			if (infos[i].sopItem.sopExecute == '1' && !infos[i].sopItemValue) {
				uni.showToast({
					title: `${taskInfo.details[i].sopItemName}的实际值只能为数字`,
					icon: 'none'
				});
				return false;
			}
		}
	}
	// 校验判断数字
	for (let i = 0; i < taskInfo.details.length; i++) {
		if (taskInfo.details[i].sopItem.standardValue == '1') {
			if (isNaN(Number(taskInfo.details[i].sopItemValue))) {
				uni.showToast({
					title: `${taskInfo.details[i].sopItemName}的实际值只能为数字`,
					icon: 'none'
				});
				return false;
			}
		}
	}
	console.log('点检提交');
	// save提交
	postLoading.value = true;
	const result: any = await http({
		method: 'POST',
		url: `/eam/equPointInspectionOrder/submit`,
		data: toRaw(taskInfo)
	}).finally(() => {
		postLoading.value = false;
	});
	if (result?.code == 200) {
		uni.showToast({
			title: '提交成功'
		});
		// useEamStore().setSelectedPosition({})
		uni.navigateTo({
			url: `/pages/eam/equ/pointInspection/index`
		});
	}
}

// 过滤设备信息
let dataDate = reactive({
	id: '',
	assetCode: '',
	assetName: '',
	locationName: '',
	assetTypeName: '',
	assetTypeId: '',
	locationId: ''
});
async function filterDeviceInfo(data) {
	dataDate = data;
	// await getSopStandardList();
	// taskInfo.assetId = data.id;
	// taskInfo.assetCode = data.assetCode;
	// taskInfo.assetName = data.assetName;
	// taskInfo.locationName = data.locationName;
	taskInfo.assetId = data.id;
	taskInfo.assetCode = data.assetCode;
	taskInfo.assetName = data.assetName;
	taskInfo.locationName = data.locationName;
	taskInfo.assetTypeName = data.assetTypeName;
	taskInfo.assetTypeId = data.assetTypeId;
	taskInfo.locationId = data.locationId;
	taskInfo.usingDepartmentName = data.usingDepartmentName;
	taskInfo.usingPersonName = data.usingPersonName;
	if (data.assetModelNo && data.assetBrandName) {
		taskInfo.assetModelNo = `${data.assetModelNo}-${data.assetBrandName}`;
	} else if (data.assetModelNo && !data.assetBrandName) {
		taskInfo.assetModelNo = `${data.assetModelNo}`;
	} else if (!data.assetModelNo && data.assetBrandName) {
		taskInfo.assetModelNo = `${data.assetBrandName}`;
	}
}

// 网页跳转
function jump(item, id = '') {
	console.log('id', taskInfo);
	uni.navigateTo({
		url: id ? `/pages${item}?id=${id}` : `/pages${item}`,
		fail: () => {
			uni.showToast({
				title: '敬请期待',
				icon: 'error'
			});
		}
	});
}

function jumpStandard(item, typeId = '', locationId = '') {
	console.log('id', taskInfo);
	uni.navigateTo({
		url: `/pages${item}?equipTypeId=${typeId}&locationId=${locationId}`,
		fail: () => {
			uni.showToast({
				title: '敬请期待',
				icon: 'error'
			});
		}
	});
}

// 获取设备信息（接口请求）
async function getDeviceInfo(assetCode: string) {
	const { data }: any = await http({
		method: 'GET',
		url: `/eam/equAssetInfo/getInfo/${assetCode}`,
		data: {}
	});
	filterDeviceInfo(data);
}
// 选择设备信息
const deviceList = computed(() => JSON.parse(useEamStore().deviceList));
// 监控设备选择id
watch(
	() => deviceList,
	async (newVal) => {
		if (newVal.value[0]?.id) {
			taskInfo.assetId = newVal.value[0]?.id;

			filterDeviceInfo(newVal.value[0]);
		}
		setTimeout(() => {
			useEamStore().setDeviceList();
		}, 1000);
	},
	{
		deep: true,
		immediate: true
	}
);

// 选择点检项
// 选择设备信息

// 过滤设备信息

async function filterPointInfo(data) {
	dataDate = data;
	// await getSopStandardList();
	taskInfo.assetId = data.id;
	taskInfo.assetCode = data.assetCode;
	taskInfo.assetName = data.assetName;
	taskInfo.locationName = data.locationName;
	taskInfo.locationId = data.locationId;
	taskInfo.assetTypeId = data.assetTypeId;
}

const pointList = computed(() => JSON.parse(useEamStore().pointList));
// 监控设备选择id
const sopStandardIds = ref('');
const sopStandardNames = ref('');

const taskInfo1 = ref([]);
const newPointCheckOrderList = ref({});
let boxTitle = ref('');
const getNewPointCheckOrder = async (sopStandardList) => {
	console.log('---sopStandardList---', sopStandardList);
	const result: PageResult<any> = await http({
		method: 'POST',
		url: '/eam/equPointInspectionOrder/newPointCheckOrder',
		data: sopStandardList
	});

	newPointCheckOrderList.value = Object.assign(newPointCheckOrderList.value, result.data);
	taskInfo.sopStandardCode = result.data.sopStandardCode;
	taskInfo.sopStandardId = result.data.sopStandardId;
	taskInfo.sopStandardName = result.data.sopStandardName;
	taskInfo.sopTypeCode = result.data.sopTypeCode;
	taskInfo.sopTypeId = result.data.sopTypeId;
	taskInfo.sopTypeName = result.data.sopTypeName;
	taskInfo.details = result.data.details;
	// Object.assign(taskInfo, newPointCheckOrderList.value);

	// taskInfo.assetId = dataDate.id;
	taskInfo.assetKind = props.assetKind;
	// taskInfo.assetCode = dataDate.assetCode;
	// taskInfo.assetName = dataDate.assetName;
	// taskInfo.locationName = dataDate.locationName;
	// taskInfo.details = newPointCheckOrderList.value.details;

	// 	boxTitle.value = result.data.sopStandardName;
};

// 再次获取首页检点标准  然后根据传回的id赋值整条数据
const sopStandardList = ref([]);
const getSopStandardList = async (id) => {
	sopStandardList.value = [];
	const result = await http({
		method: 'POST',
		url: '/eam/equPointInspection/getSopStandardList',
		data: {}
	});
	result.data.forEach((item) => {
		if (item.id == id) {
			sopStandardList.value.push(item);

			getNewPointCheckOrder(sopStandardList.value[0]);
		}
	});
};

// 点击扫码
const searchText = ref('');
function openScan() {
	/* #ifdef H5 */
	uni.showToast({
		icon: 'none',
		title: '请到安卓设备进行扫码'
	});
	/* #endif */
	// 只允许通过相机扫码
	uni.scanCode({
		scanType: ['barCode', 'qrCode'],
		onlyFromCamera: true,
		success: function (res) {
			searchText.value = JSON.stringify(res.result);
			getDeviceInfo(searchText.value);
		}
	});
}

// 是否折叠
const isCollapse = ref(false);

// -----------------------------------------------------编辑
async function initPage() {
	try {
		const result: any = await http({
			method: 'GET',
			url: `/eam/equPointInspectionOrder/get/${props.id}`,
			data: {}
		}).finally(() => {});
		taskInfo = Object.assign(taskInfo, {
			...result.data,
			images: result.data.images || [],
			executeFiles: result.data.executeFiles || [],
			parts: result.data.parts || []
		});
		sopStandardIds.value = taskInfo.sopStandardId;
		sopStandardNames.value = taskInfo.sopStandardName;
	} catch (e) {}
}

watch(
	() => pointList,
	async (newVal) => {
		if (newVal.value[0]?.id) {
			// Object.assign(taskInfo, newVal.value[0]);
			console.log('newVal.value[0]', newVal.value[0]);
			// sopStandardIds.value = "";
			// sopStandardNames.value = "";
			sopStandardIds.value = newVal.value[0].id;
			sopStandardNames.value = newVal.value[0].standardName;
			console.log(sopStandardIds.value, sopStandardNames.value);
			await getSopStandardList(newVal.value[0].id);
			// taskInfo.assetId = dataDate.id;
			// taskInfo.assetCode = dataDate.assetCode;
			// taskInfo.assetName = dataDate.assetName;
			// taskInfo.locationName = dataDate.locationName;
		}
		setTimeout(() => {
			useEamStore().setPointList();
		}, 1000);
	},
	{
		deep: true,
		immediate: true
	}
);

onBackPress(() => {
	back1();
	return true;
});
const back1 = () => {
	// useEamStore().setSelectedPosition({});
	uni.navigateTo({
		url: '/pages/eam/equ/pointInspection/index',
		animationDuration: 200
	});
};
</script>

<style lang="scss" scoped>
@import '@/static/css/standard_item.scss';

.handle-ok {
	min-width: 75px;
	color: #19be6b;
}

.card {
	background-color: #fff;
	margin: 10px 10px;
	border-radius: 8px;
	padding: 12px 12px;
	transition: all 300ms ease;
	box-shadow: 0 2px 6px rgba(3, 121, 255, 0.05);
}

.overhidden {
	overflow: hidden;
}

uni-page-body {
	height: 100%;
	background-color: #fbfbff;
}

.u-divider {
	margin: 10px 0;
}

.baseForm {
	background-color: #fbfbff;
	display: block;
}

.title {
	font-size: 16px;
	margin: 6px 0 14px;
	font-weight: bold;

	.u-icon {
		margin-right: 3px;
	}
}

.submit_btn {
	margin: 20rpx 20rpx;
	border-radius: 60rpx;
	height: 45px;
	font-size: 16px;
	line-height: 45px;
	box-shadow: 0 1px 10px rgba(3, 121, 255, 0.3);
}

.grey_btn {
	margin: 20rpx 20rpx;
	background-color: #fff !important;
	border: 1px solid #999;
	box-shadow: 0 1px 10px rgba(22, 37, 78, 0.08);
	color: #4f4f4f;
}

.searchScan {
	display: flex;
	height: 37px;
	padding: 12px 12px 0px;

	:deep(.u-input) {
		border: none;
		background-color: #fff !important;
		box-shadow: 0 1px 8px 0px rgb(19 10 236 / 8%);
	}

	.addBtn1 {
		width: 60px;
		height: 36px;
		margin-left: -3px !important;

		:deep(.u-button__text) {
			font-size: 14px !important;
		}
	}
}

:deep(.u-form-item__body) {
	padding: 4px 0 12px;
}

:deep(.u-form-item) {
	.u-form-item__body__left__content__label {
		color: #a8b2bb;
		font-size: 14px;
		margin-bottom: 1px;
	}

	.u-form-item__body__left__content__required {
		font-size: 16px;
	}

	// 单选不可编辑样式
	.u-radio {
		.u-radio__icon-wrap--disabled {
			background-color: rgb(255, 255, 255) !important;
		}

		.u-radio__icon-wrap--disabled--checked {
			background-color: rgb(41, 121, 255) !important;
			border-color: rgb(41, 121, 255) !important;

			.u-icon__icon {
				color: #fff !important;
			}
		}

		.u-radio__text {
			color: #16254e !important;
			font-size: 14px !important;
		}
	}

	.u-textarea--disabled {
		background-color: #fff !important;
	}

	.uni-textarea-textarea {
		color: #16254e !important;
	}

	.input-box {
		width: 100%;

		border: 0.5px solid #dadbde !important;
		border-radius: 4px;

		.u-input {
			pointer-events: none;
			height: 34px;
			padding-left: 10px !important;
		}

		image {
			padding: 7px 6px;
			width: 20px;
			height: 20px;
		}
	}
}

.submit_btn_div {
	// display: flex;
	// justify-content: space-between;
}

.mt-10- {
	margin-top: -30px;
}

:deep(.u-modal__content__text) {
	font-size: 14px;
}

:deep(.u-modal__content) {
	padding: 15px 15px 0;
}
</style>
